/**
 * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

package com.hotel.test.model.impl;

import com.hotel.test.model.RomType;
import com.hotel.test.model.RomTypeModel;

import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.util.DateUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import com.liferay.portal.kernel.util.StringPool;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.PortalUtil;

import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;

import java.io.Serializable;

import java.sql.Types;

import java.util.Date;

/**
 * The base model implementation for the RomType service. Represents a row in the &quot;HT_RomType&quot; database table, with each column mapped to a property of this class.
 *
 * <p>
 * This implementation and its corresponding interface {@link com.hotel.test.model.RomTypeModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link RomTypeImpl}.
 * </p>
 *
 * @author Vien-IT
 * @see RomTypeImpl
 * @see com.hotel.test.model.RomType
 * @see com.hotel.test.model.RomTypeModel
 * @generated
 */
public class RomTypeModelImpl extends BaseModelImpl<RomType>
	implements RomTypeModel {
	/*
	 * NOTE FOR DEVELOPERS:
	 *
	 * Never modify or reference this class directly. All methods that expect a rom type model instance should use the {@link com.hotel.test.model.RomType} interface instead.
	 */
	public static final String TABLE_NAME = "HT_RomType";
	public static final Object[][] TABLE_COLUMNS = {
			{ "romId", Types.BIGINT },
			{ "userId", Types.BIGINT },
			{ "userName", Types.VARCHAR },
			{ "createDate", Types.TIMESTAMP },
			{ "modifiedDate", Types.TIMESTAMP },
			{ "roomName", Types.VARCHAR },
			{ "information", Types.VARCHAR },
			{ "numberOfGuest", Types.INTEGER },
			{ "rice", Types.VARCHAR },
			{ "numberOfRoom", Types.INTEGER },
			{ "hotelId", Types.BIGINT }
		};
	public static final String TABLE_SQL_CREATE = "create table HT_RomType (romId LONG not null primary key,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,roomName VARCHAR(75) null,information VARCHAR(75) null,numberOfGuest INTEGER,rice VARCHAR(75) null,numberOfRoom INTEGER,hotelId LONG)";
	public static final String TABLE_SQL_DROP = "drop table HT_RomType";
	public static final String ORDER_BY_JPQL = " ORDER BY romType.modifiedDate ASC";
	public static final String ORDER_BY_SQL = " ORDER BY HT_RomType.modifiedDate ASC";
	public static final String DATA_SOURCE = "liferayDataSource";
	public static final String SESSION_FACTORY = "liferaySessionFactory";
	public static final String TX_MANAGER = "liferayTransactionManager";
	public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.entity.cache.enabled.com.hotel.test.model.RomType"),
			true);
	public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.finder.cache.enabled.com.hotel.test.model.RomType"),
			true);
	public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
				"value.object.column.bitmask.enabled.com.hotel.test.model.RomType"),
			true);
	public static long ROOMNAME_COLUMN_BITMASK = 1L;
	public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
				"lock.expiration.time.com.hotel.test.model.RomType"));

	public RomTypeModelImpl() {
	}

	public long getPrimaryKey() {
		return _romId;
	}

	public void setPrimaryKey(long primaryKey) {
		setRomId(primaryKey);
	}

	public Serializable getPrimaryKeyObj() {
		return new Long(_romId);
	}

	public void setPrimaryKeyObj(Serializable primaryKeyObj) {
		setPrimaryKey(((Long)primaryKeyObj).longValue());
	}

	public Class<?> getModelClass() {
		return RomType.class;
	}

	public String getModelClassName() {
		return RomType.class.getName();
	}

	public long getRomId() {
		return _romId;
	}

	public void setRomId(long romId) {
		_romId = romId;
	}

	public long getUserId() {
		return _userId;
	}

	public void setUserId(long userId) {
		_userId = userId;
	}

	public String getUserUuid() throws SystemException {
		return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
	}

	public void setUserUuid(String userUuid) {
		_userUuid = userUuid;
	}

	public String getUserName() {
		if (_userName == null) {
			return StringPool.BLANK;
		}
		else {
			return _userName;
		}
	}

	public void setUserName(String userName) {
		_userName = userName;
	}

	public Date getCreateDate() {
		return _createDate;
	}

	public void setCreateDate(Date createDate) {
		_createDate = createDate;
	}

	public Date getModifiedDate() {
		return _modifiedDate;
	}

	public void setModifiedDate(Date modifiedDate) {
		_columnBitmask = -1L;

		_modifiedDate = modifiedDate;
	}

	public String getRoomName() {
		if (_roomName == null) {
			return StringPool.BLANK;
		}
		else {
			return _roomName;
		}
	}

	public void setRoomName(String roomName) {
		_columnBitmask |= ROOMNAME_COLUMN_BITMASK;

		if (_originalRoomName == null) {
			_originalRoomName = _roomName;
		}

		_roomName = roomName;
	}

	public String getOriginalRoomName() {
		return GetterUtil.getString(_originalRoomName);
	}

	public String getInformation() {
		if (_information == null) {
			return StringPool.BLANK;
		}
		else {
			return _information;
		}
	}

	public void setInformation(String information) {
		_information = information;
	}

	public int getNumberOfGuest() {
		return _numberOfGuest;
	}

	public void setNumberOfGuest(int numberOfGuest) {
		_numberOfGuest = numberOfGuest;
	}

	public String getRice() {
		if (_rice == null) {
			return StringPool.BLANK;
		}
		else {
			return _rice;
		}
	}

	public void setRice(String rice) {
		_rice = rice;
	}

	public int getNumberOfRoom() {
		return _numberOfRoom;
	}

	public void setNumberOfRoom(int numberOfRoom) {
		_numberOfRoom = numberOfRoom;
	}

	public long getHotelId() {
		return _hotelId;
	}

	public void setHotelId(long hotelId) {
		_hotelId = hotelId;
	}

	public long getColumnBitmask() {
		return _columnBitmask;
	}

	@Override
	public RomType toEscapedModel() {
		if (_escapedModelProxy == null) {
			_escapedModelProxy = (RomType)ProxyUtil.newProxyInstance(_classLoader,
					_escapedModelProxyInterfaces,
					new AutoEscapeBeanHandler(this));
		}

		return _escapedModelProxy;
	}

	@Override
	public ExpandoBridge getExpandoBridge() {
		if (_expandoBridge == null) {
			_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
					RomType.class.getName(), getPrimaryKey());
		}

		return _expandoBridge;
	}

	@Override
	public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
		getExpandoBridge().setAttributes(serviceContext);
	}

	@Override
	public Object clone() {
		RomTypeImpl romTypeImpl = new RomTypeImpl();

		romTypeImpl.setRomId(getRomId());
		romTypeImpl.setUserId(getUserId());
		romTypeImpl.setUserName(getUserName());
		romTypeImpl.setCreateDate(getCreateDate());
		romTypeImpl.setModifiedDate(getModifiedDate());
		romTypeImpl.setRoomName(getRoomName());
		romTypeImpl.setInformation(getInformation());
		romTypeImpl.setNumberOfGuest(getNumberOfGuest());
		romTypeImpl.setRice(getRice());
		romTypeImpl.setNumberOfRoom(getNumberOfRoom());
		romTypeImpl.setHotelId(getHotelId());

		romTypeImpl.resetOriginalValues();

		return romTypeImpl;
	}

	public int compareTo(RomType romType) {
		int value = 0;

		value = DateUtil.compareTo(getModifiedDate(), romType.getModifiedDate());

		if (value != 0) {
			return value;
		}

		return 0;
	}

	@Override
	public boolean equals(Object obj) {
		if (obj == null) {
			return false;
		}

		RomType romType = null;

		try {
			romType = (RomType)obj;
		}
		catch (ClassCastException cce) {
			return false;
		}

		long primaryKey = romType.getPrimaryKey();

		if (getPrimaryKey() == primaryKey) {
			return true;
		}
		else {
			return false;
		}
	}

	@Override
	public int hashCode() {
		return (int)getPrimaryKey();
	}

	@Override
	public void resetOriginalValues() {
		RomTypeModelImpl romTypeModelImpl = this;

		romTypeModelImpl._originalRoomName = romTypeModelImpl._roomName;

		romTypeModelImpl._columnBitmask = 0;
	}

	@Override
	public CacheModel<RomType> toCacheModel() {
		RomTypeCacheModel romTypeCacheModel = new RomTypeCacheModel();

		romTypeCacheModel.romId = getRomId();

		romTypeCacheModel.userId = getUserId();

		romTypeCacheModel.userName = getUserName();

		String userName = romTypeCacheModel.userName;

		if ((userName != null) && (userName.length() == 0)) {
			romTypeCacheModel.userName = null;
		}

		Date createDate = getCreateDate();

		if (createDate != null) {
			romTypeCacheModel.createDate = createDate.getTime();
		}
		else {
			romTypeCacheModel.createDate = Long.MIN_VALUE;
		}

		Date modifiedDate = getModifiedDate();

		if (modifiedDate != null) {
			romTypeCacheModel.modifiedDate = modifiedDate.getTime();
		}
		else {
			romTypeCacheModel.modifiedDate = Long.MIN_VALUE;
		}

		romTypeCacheModel.roomName = getRoomName();

		String roomName = romTypeCacheModel.roomName;

		if ((roomName != null) && (roomName.length() == 0)) {
			romTypeCacheModel.roomName = null;
		}

		romTypeCacheModel.information = getInformation();

		String information = romTypeCacheModel.information;

		if ((information != null) && (information.length() == 0)) {
			romTypeCacheModel.information = null;
		}

		romTypeCacheModel.numberOfGuest = getNumberOfGuest();

		romTypeCacheModel.rice = getRice();

		String rice = romTypeCacheModel.rice;

		if ((rice != null) && (rice.length() == 0)) {
			romTypeCacheModel.rice = null;
		}

		romTypeCacheModel.numberOfRoom = getNumberOfRoom();

		romTypeCacheModel.hotelId = getHotelId();

		return romTypeCacheModel;
	}

	@Override
	public String toString() {
		StringBundler sb = new StringBundler(23);

		sb.append("{romId=");
		sb.append(getRomId());
		sb.append(", userId=");
		sb.append(getUserId());
		sb.append(", userName=");
		sb.append(getUserName());
		sb.append(", createDate=");
		sb.append(getCreateDate());
		sb.append(", modifiedDate=");
		sb.append(getModifiedDate());
		sb.append(", roomName=");
		sb.append(getRoomName());
		sb.append(", information=");
		sb.append(getInformation());
		sb.append(", numberOfGuest=");
		sb.append(getNumberOfGuest());
		sb.append(", rice=");
		sb.append(getRice());
		sb.append(", numberOfRoom=");
		sb.append(getNumberOfRoom());
		sb.append(", hotelId=");
		sb.append(getHotelId());
		sb.append("}");

		return sb.toString();
	}

	public String toXmlString() {
		StringBundler sb = new StringBundler(37);

		sb.append("<model><model-name>");
		sb.append("com.hotel.test.model.RomType");
		sb.append("</model-name>");

		sb.append(
			"<column><column-name>romId</column-name><column-value><![CDATA[");
		sb.append(getRomId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userId</column-name><column-value><![CDATA[");
		sb.append(getUserId());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>userName</column-name><column-value><![CDATA[");
		sb.append(getUserName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>createDate</column-name><column-value><![CDATA[");
		sb.append(getCreateDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
		sb.append(getModifiedDate());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>roomName</column-name><column-value><![CDATA[");
		sb.append(getRoomName());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>information</column-name><column-value><![CDATA[");
		sb.append(getInformation());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numberOfGuest</column-name><column-value><![CDATA[");
		sb.append(getNumberOfGuest());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>rice</column-name><column-value><![CDATA[");
		sb.append(getRice());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>numberOfRoom</column-name><column-value><![CDATA[");
		sb.append(getNumberOfRoom());
		sb.append("]]></column-value></column>");
		sb.append(
			"<column><column-name>hotelId</column-name><column-value><![CDATA[");
		sb.append(getHotelId());
		sb.append("]]></column-value></column>");

		sb.append("</model>");

		return sb.toString();
	}

	private static ClassLoader _classLoader = RomType.class.getClassLoader();
	private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
			RomType.class
		};
	private long _romId;
	private long _userId;
	private String _userUuid;
	private String _userName;
	private Date _createDate;
	private Date _modifiedDate;
	private String _roomName;
	private String _originalRoomName;
	private String _information;
	private int _numberOfGuest;
	private String _rice;
	private int _numberOfRoom;
	private long _hotelId;
	private transient ExpandoBridge _expandoBridge;
	private long _columnBitmask;
	private RomType _escapedModelProxy;
}